<?php
/**
 * Created by PhpStorm.
 * User: eugene
 * Date: 2018/4/26
 * Time: 14:03
 */

namespace App\Transformers;


class CardSeriesTransformer extends Transformer
{
    
    public function transform($item)
    {
        return [
            'id'=>$item->id,
            'name'=>$item->name,
            'rules'=>$item->rule,
            'img'=>$item->img,
            'first_img'=>$item->first_img,
            'card_img'=>$item->cards->first()->img,
            'total'=>$item->cards->count(),
            'hold'=>0,
            'start_time'=>$item->cards->min('startTime'),
            'end_time'=>$item->cards->max('endTime'),
            'rewards'=>[],
            'is_full'=>0,
            'cards'=>null,
        ];
    }
}